﻿<div ng-controller="activityController">
    <div class="wrapper border-bottom white-bg page-heading">
        <div class="col-lg-pull-12">
            <ol class="breadcrumb">
                <li><a href="javascript:void(0)" ng-click="goBack()">活动</a></li>
                <li class="active" ng-bind="breadcrumb"></li>
            </ol>
        </div>
    </div>
    <form name="_form" class="form-horizontal w5c-form" w5c-form-validate="model.validateOptions" role="form" novalidate>
        <div class="form-group form-group-sm">
            <label class="col-sm-2 control-label">活动标题</label>
            <div class="col-sm-3">
                <input type="text" name="title" class="form-control " ng-model="model.title" ng-maxlength="35" placeholder="请输入活动标题" required>
            </div>
        </div>
        <div class="form-group form-group-sm">
            <label class="col-sm-2 control-label">活动类型</label>
            <div class="col-sm-2">
                <select name="type" class="form-control input-sm" ng-model="model.activity_type_value" required>
                    <option ng-repeat="x in model.e_activity_type_list" value="{{x.value}}">{{x.text}}</option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">图片</label>
            <div class="col-sm-5">
                <input name="img_url" type="file" ngf-select ng-model="model.file" accept="image/*" class="form-control input-sm">
                <img ng-src="{{site.img_url+model.img_url}}" class="img-thumbnail" ng-show="model.img_url" width="60" height="80">
            </div>
            <!--<div class="col-sm-5 form-control-static">
            <span style="color:#d3d3d3">上传图片建议尺寸为：84px*84px！</span>
        </div>-->
        </div>
        <div ng-if="model.activity_type_value != '3' && model.activity_type_value != '4' && model.activity_type_value != '5'" class="form-group form-group-sm">
            <label class="col-sm-2 control-label">活动链接</label>
            <div class="col-sm-3">
                <input type="text" name="link_url" class="form-control" placeholder="请输入活动链接" ng-model="model.link_url">
            </div>
        </div>
        <div ng-if="model.id != 0 && (model.activity_type_value == '3' || model.activity_type_value == '4' || model.activity_type_value == '5')" class="form-group form-group-sm">
            <label class="col-sm-2 control-label">链接地址</label>
            <div class="col-sm-8">
                <div ng-if="model.activity_type_value == '3'" class="col-sm-12 form-control-static">
                    {{token_api_url + 'ProductActivity/ProductTimeBuy?activityId=' + model.id}}
                </div>
                <div ng-if="model.activity_type_value == '4'" class="col-sm-12 form-control-static">
                    {{token_api_url + 'ProductActivity/ProductCashRedDrill?activityId=' + model.id}}
                </div>
                <div ng-if="model.activity_type_value == '5'" class="col-sm-12 form-control-static">
                    {{token_api_url + 'Consumption/Index'}}
                </div>
            </div>
        </div>
        <div class="form-group form-group-sm">
            <label class="col-sm-2 control-label">活动规则</label>
            <div class="col-sm-10">
                <textarea keditor="editConfig" name="detail" class="form-control input-sm" ng-model="model.detail" rows="4" w5c-dynamic-element ng-change="textAreaChanged()" required></textarea>
                <span ng-show="_form.description.$invalid && !_form.description.$pristine" class="w5c-error">请填写活动规则</span>
                <span class="help-block" id="textcount">0/2000</span>
            </div>
        </div>
        <div ng-if="model.activity_type_value == '3' || model.activity_type_value == '4' || model.activity_type_value == '5'" class="form-group form-group-sm">
            <label class="col-sm-2 control-label">预热开始时间</label>
            <div class="col-sm-3">
                <div datetime class="input-group date">
                    <input class="form-control input-sm" ng-model="model.preheat_time" required>
                    <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
                </div>
            </div>
        </div>
        <div class="form-group form-group-sm">
            <label class="col-sm-2 control-label">开始时间</label>
            <div class="col-sm-3">
                <div datetime class="input-group date">
                    <input class="form-control input-sm" ng-model="model.begin_time" required>
                    <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
                </div>
            </div>
        </div>
        <div class="form-group form-group-sm">
            <label class="col-sm-2 control-label">结束时间</label>
            <div class="col-sm-3">
                <div datetime class="input-group date">
                    <input class="form-control input-sm" ng-model="model.end_time" required>
                    <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
                </div>
            </div>
        </div>
        <div class="form-group form-group-sm">
            <label class="col-sm-2 control-label">状态</label>
            <div class="col-sm-2">
                <select name="status" class="form-control input-sm" ng-model="model.status_value" required>
                    <option ng-repeat="x in model.e_status_list" value="{{x.value}}">{{x.text}}</option>
                </select>
            </div>
        </div>
        <div class="form-group form-group-sm">
            <label class="col-sm-2 control-label"></label>
            <div class="col-sm-3">
                <button ng-if="((model.status != 1 && model.type != 3 && model.type != 4 && model.type != 5) || model.status == 0) || model.id == 0" type="submit" w5c-form-submit="save()" class="btn btn-primary btn-sm" btn-loading="psdisabled.save" loading-text="保存中..." ng-disabled="psdisabled.save">
                    <i class="fa fa-save"></i> 保存
                </button>
                <button ng-if="((model.status != 1 && model.type != 3 && model.type != 4 && model.type != 5) || model.status == 0) || model.id == 0" ng-click="goBack()" class="btn btn-primary btn-sm"><i class="fa fa-rotate-left"></i> 取消</button>
                <button ng-if="model.status == 1 || ((model.type == 3 || model.type == 4 || model.type == 5) && model.status == 2)" ng-click="goBack()" class="btn btn-primary btn-sm"><i class="fa fa-rotate-left"></i> 返回</button>
            </div>
        </div>
    </form>
</div>